

<template>
	<view class="hot-list">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="header">
				<ad-swipers :pid="32" height="340rpx" padding="20rpx 20rpx 0 20rpx" radius="10px"></ad-swipers>
            </view>
			<view class="main">
				<goods-list :list="goodsList" type="hot"></goods-list>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import {
		getGoodsListColumn
	} from '@/api/store';
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				upOption: {
					empty: {
						icon: "/static/images/goods_null.png",
						tip: "暂无商品～"
					}
				},
				goodsList: [],
				type: ''
			};
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title: '赚取必推'
			})
		},
		methods: {
			upCallback(page) {
				let pageNum = page.num;
				let pageSize = page.size;
				const shopInfo = uni.getStorageSync('selectStoreInfo')
				const params = {
					page_no: pageNum,
					page_size: pageSize,
					column_id: 1,
					shop_id:shopInfo.id
				}
				getGoodsListColumn(params).then(res => {
					if (res.code == 1) {
						let curPageData = res.data.lists;
						let curPageLen = curPageData.length;
						let hasNext = !!res.data.more;
						if (page.num == 1) {
							this.goodsList = [];
						}
						this.goodsList = this.goodsList.concat(curPageData);
						this.mescroll.endSuccess(curPageLen, hasNext);
					}
				}).catch(err => {
					this.mescroll.endErr()
				})
			},
		}
	};
</script>
<style lang="scss">
	.hot-list {
		.main {

			.list-title {
				margin: 27rpx 0 30rpx;
			}
			.hot {
				padding: 0 30rpx;
			}
		}

	}
</style>
